package com.baor.controller;


import com.baor.domain.ScheduleVo;
import com.baor.domain.TeacherClassVo;
import com.baor.service.ScheduleService;
import com.baor.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/schedule")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    @RequestMapping("/list/{classId}")
    public AjaxResult<?> list(@PathVariable Integer classId){
        return scheduleService.list(classId);
    }

    @RequestMapping("/insert")
    public AjaxResult<?> insert(@RequestBody List<ScheduleVo> list){
        return scheduleService.insert(list);
    }

    @RequestMapping("/check")
    public AjaxResult<?> check(@RequestBody List<ScheduleVo> list){
        return scheduleService.check(list);
    }

    @RequestMapping("/update")
    public AjaxResult<?> update(@RequestBody List<ScheduleVo> list){
        return scheduleService.update(list);
    }

    @RequestMapping("/week")
    public AjaxResult<?> week(){
        return scheduleService.week();
    }

    @RequestMapping("/course")
    public AjaxResult<?> course(){
        return scheduleService.course();
    }

    @RequestMapping("/teachers/{subjectId}")
    public AjaxResult<?> subjectId(@PathVariable Integer subjectId){
        return scheduleService.subjectId(subjectId);
    }

    @RequestMapping("teachers/delect")
    public AjaxResult<?> deleteT(@RequestBody TeacherClassVo teacherClassVo){
        return scheduleService.deleteT(teacherClassVo);
    }
}
